package top.toptimus.dto.accessory;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.dto.material.materialIndex.MaterialDTO;

/**
 * 辅料选择项目
 * TODO 命名太恶心了
 */
@NoArgsConstructor
@Data
@AllArgsConstructor
public class DtoForChooseContrasts {
    private String material_id;
    private String material_code;
    private String material_name_cn;
    private String material_spec;
    private String material_location;//位置
    private String partId;//位置id
    private double count;//单耗

    public DtoForChooseContrasts(MaterialDTO materialDTO) {
        this.material_id = materialDTO.getMaterial_id();
        this.material_code = materialDTO.getMaterial_code();
        this.material_name_cn = materialDTO.getMaterial_name_cn();
        this.material_spec = materialDTO.getMaterial_spec();
    }

    public DtoForChooseContrasts build(AccessoryPartDTO accessoryPartDTO) {
        if (null != accessoryPartDTO) {
            this.partId = accessoryPartDTO.getId();
            this.material_location = accessoryPartDTO.getPartName();
        }
        return this;
    }

    public DtoForChooseContrasts build(double count) {
        this.count = count;
        return this;
    }
}
